package com.blacktry.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.blacktry.convent.QuestionConvert;
import com.blacktry.entity.model.request.QuestionRequest;
import com.blacktry.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * <p>
 * 填空题题库 服务实现类
 * </p>
 *
 * @author blackTry
 * @since 2021-08-10
 */
@Service
public class QuestionServiceImpl implements QuestionService {

    @Autowired
    private PaperManageService paperManageService;

    @Autowired
    private MultiQuestionService multiQuestionService;

    @Autowired
    private FillQuestionService fillQuestionService;

    @Autowired
    private JudgeQuestionService judgeQuestionService;

    @Autowired
    private SubjectiveQuestionService subjectiveQuestionService;

    @Override
    public int insert(QuestionRequest question) {
        if(question.getFlag()==1){
            multiQuestionService.insert(QuestionConvert.INSTANCE.Question2Multi(question));
        }else if(question.getFlag()==2){
            fillQuestionService.insert(QuestionConvert.INSTANCE.Question2Fill(question));
        }else if(question.getFlag()==3){
            judgeQuestionService.insert(QuestionConvert.INSTANCE.Question2Judge(question));
        }else if(question.getFlag()==4){
            subjectiveQuestionService.insert(QuestionConvert.INSTANCE.Question2Subjective(question));
        }else{
            return -1;
        }
        return 0;
    }

    @Override
    public Integer delete(Integer id) {
        return null;
    }

    @Override
    public Integer deleteBatchIds(String[] ids) {
        return null;
    }

    @Override
    public Integer updateOrInsert(QuestionRequest question) {
        return null;
    }

    @Override
    public QuestionRequest select(Integer id) {
        return null;
    }

    @Override
    public List<QuestionRequest> selectAll() {
        return null;
    }

    @Override
    public Page<QuestionRequest> selectPage(QuestionRequest question, Page<QuestionRequest> QuestionPage) {
        return null;
    }

    @Override
    public List<QuestionRequest> findByType(Integer flag) {
        return null;
    }
}
